package com.dxysun.springboot.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebFilterConfig
{
	@Bean
	public FilterRegistrationBean<LogFilter> logFilter()
	{
		FilterRegistrationBean<LogFilter> registration = new FilterRegistrationBean<>();
		registration.setFilter(new LogFilter());
		registration.addUrlPatterns("/*");
		registration.setName("logFilter");
		registration.setOrder(-100);
		return registration;
	}

	@Bean
	public FilterRegistrationBean<DataFilter> dataFilter()
	{
		FilterRegistrationBean<DataFilter> registration = new FilterRegistrationBean<>();
		registration.setFilter(new DataFilter());
		registration.addUrlPatterns("/*");
		registration.setName("dataFilter");
		registration.setOrder(-10);
		return registration;
	}
}
